﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using Wpf_Examples.Tools;

namespace Wpf_Examples.Views
{
    /// <summary>
    /// ParticleWaveEffect.xaml 的交互逻辑
    /// </summary>
    public partial class ParticleWaveEffect : Window
    {
        private readonly CreateParticleWaveEffectHelper cpweHelper;
        private DispatcherTimer _frameTimer;
        public ParticleWaveEffect()
        {
            InitializeComponent();

            _frameTimer = new DispatcherTimer();
            _frameTimer.Tick += TimerUpdate;
            _frameTimer.Interval = TimeSpan.FromSeconds(1.0 / 60.0);
            _frameTimer.Start();

            cpweHelper = new CreateParticleWaveEffectHelper(40, 40, Colors.White, 30);

            WorldModels.Children.Add(cpweHelper.ParticleModel);
            Cursor = Cursors.None;
        }

        private void TimerUpdate(object sender, EventArgs e)
        {
            cpweHelper.Update();
        }
    }
}
